<?php
import('libs.abstract.AbstractModule');
import('modules.test.entity.TestEntity');
/**
 * Description of Test
 *
 * @author gaetan
 */
class Test extends AbstractModule {


	public function selectDepuisBdd(){
		echo '<pre>';
		echo TestEntity::getCreateCode();
		echo '</pre><hr />';

		$t = new TestEntity(1);
		var_dump($t->getFields());
		
		echo '<hr />';
		$res = Base::getSql()->query(TestEntity::reqSelectMany());
		while($d = $res->fetch()){
			$t = new TestEntity($d);
			var_dump($t->getFields());
		}

		echo '<hr />';
		$t = new TestEntity();
		$t->nom = "blabla l'écolier -- avec une injection";
		var_dump(AbstractEntity::reqInsert($t));

		echo '<hr />';
		
		$t = new TestEntity(1);
		$t->nom = "modif";
		var_dump(AbstractEntity::reqUpdate($t));

		echo '<hr />';
		var_dump(AbstractEntity::reqDelete($t));

	}

}
?>
